// "Copyright [2021] <Copyright Shengkai Lin>"

#ifndef SIMPLE_MODULES_OPTICAL_DEVICE_H_
#define SIMPLE_MODULES_OPTICAL_DEVICE_H_

#include <unordered_map>
#include "cluster/basic/ai_sim.h"

namespace ai_sim {

struct PortStatus {
    int dest_port;
    omnetpp::simtime_t switch_finish_time;
};

class OpticalDevice : public omnetpp::cSimpleModule {
 private:
    int opticaldevice_type;
    double switch_delay;
    int numOptical_port;
    int my_index;
    std::unordered_map<int, PortStatus> route_table;

 protected:
    void initialize() override;
    // The following redefined virtual function holds the algorithm.
    void handleMessage(omnetpp::cMessage *msg) override;
};
}  // namespace ai_sim

#endif  // SIMPLE_MODULES_OPTICAL_DEVICE_H_
